import { defineStore } from "pinia";
import { ref } from "vue";
import axios  from "axios";

interface Comments {
    name: string;
    url: string;
    picurl: string;
    artistsname: string;
    avatarurl: string;
    nickname: string;
    content: string;

}



export const useCommentStore = defineStore('comments',()=>{
    const tableData = ref<Comments[]>([])

    //方法 
    async function queryComment() {
        //网络请求
        const url = "https://api.uomg.com/api/comments.163?format=json"

        const res = await axios.get(url)

        const data = res.data.data

        tableData.value.push(data)


    }



    return {   tableData, queryComment   }


})